<template>
  <div>
      <div>
        <div class="carousel-container" >
          <el-carousel class="model1" :interval="5000" arrow="always" height="600px;">
            <el-carousel-item v-for="(item,index) in header" :key="index" class="sywz">
              <img class="imdt" :src="item.url" />
              <p class="medium1">{{item.name}}</p>
              <p class="medium2">{{item.con}}</p>
            </el-carousel-item>
          </el-carousel>
        </div>
      </div>
    <div class="model2">
       <div class="photo">
          <p
            style="
              font-size: 42px;
              font-family: DFLiJinHeiW8-GB, DFLiJinHeiW8-GB-Regular;
              font-weight: 400;
              text-align: center;
              color: #279e70;
              line-height: 120px;
                  margin: 0;
            "
          >
            活动盛典
            <span style="position: relative;top: -85px;font-size:25px;">
              HUODONGSHENGDIAN
            </span>
          </p>
        </div>
      <div class="pmgd">
        <div class="pmgdxc">
          <div style="width:99%;height:150px;padding:10px;background:#fff;">
            <!-- <div v-for="(item,index) in list" :key="index" @click="hqxq(item)">
              <img :src="item.thumb" style="width:295px;height:150px;margin-left:10px;" />
            </div> -->
            <carousel :per-page="6" :loop="true" :autoplay="true" :autoplay-timeout="3000">
                <slide v-for="(item, index) in list" :key="index" >
                    <img :src="item.thumb" style="width:295px;height:150px;margin-left:10px;" @click="openLightbox(index,item)" alt="Image" />
                </slide>
            </carousel>
          </div>
        </div>
      </div>
      <div class="bzjd">
        <div style="padding: 10px">
          <p class="pSty">{{hdxq.source}}</p>
          <div class="spanSty" v-html="hdxq.note">
          </div>
        </div>
      </div>
    </div>
    <el-dialog :visible.sync="isLightboxOpen">
      <img width="100%" :src="lightboxImages" alt="">
    </el-dialog>
  </div>
</template>
<script>
// import 'swiper/css/swiper.css'; // 引入 swiper 样式
import { Carousel, Slide } from 'vue-carousel'
import VueImageLightbox from 'vue-image-lightbox'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import { service } from '@/request'
// import { service } from "@/request";
export default {
  components: {
    swiper,
    swiperSlide,
    Carousel,
    Slide,
    VueImageLightbox
  },
  data () {
    return {
      showCarousel: true,
      header: [],
      swiperOptions: {
        slidesPerView: 'auto',
        spaceBetween: 10,
        centeredSlides: true,
        loop: false,
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev'
        }
      },
      imageList: [
        '../assets/image/1.png',
        '../assets/image/2.png',
        '../assets/image/3.png'
      ],
      list: [],
      hdxq: {},
      isLightboxOpen: false,
      lightboxIndex: 0,
      lightboxImages: '../assets/image/1.png'
    }
  },
  computed: {

  },
  created () {},
  mounted () {
    // setTimeout(() => {
    //   const div = document.querySelector('.fade-transition');
    //   div.style.maxHeight = '0';
    // }, 8000);
    setTimeout(() => {
      this.showCarousel = false
    }, 8000)
    this.getList()
    this.Carousel()
  },
  methods: {
    openLightbox (index, item) {
      console.log('123312')
      this.lightboxImages = item.thumb
      this.lightboxIndex = index
      this.isLightboxOpen = true
    },
    closeLightbox () {
      this.isLightboxOpen = false
    },
    hqxq (item) {
      // 在这里添加点击图片时的操作逻辑
    },
    hqxq (item) {
      this.hdxq = item
    },
    // 获取列表
    getList () {
      service({
        url: '/go/activitylist',
        method: 'post',
        data: {
          ttype: 0
        }
      }).then((data) => {
        if (data.code == 200) {
          this.list = data.data
          this.hdxq = this.list[0]
        }
      })
    },
    // 轮播图
    Carousel () {
      service({
        url: '/go/carousel',
        method: 'post',
        data: {}
      }).then((data) => {
        if (data.code == 200) {
          this.header = data.data
        }
      })
    }
  }
}
</script>
<style scoped>
.fade-transition {
  transition: transform 0.5s ease;
  overflow: hidden;
}
.horizontal-scroll .swiper-container {
  width: 100%; /* 设置容器宽度 */
}

/* 自定义导航按钮样式（可选）*/
.horizontal-scroll .swiper-button-next::after,
.horizontal-scroll .swiper-button-prev::before {
  content: '';
  display: block;
  background-color: #ccc;
  height: 4px;
  width: 50px;
}
.pmgd {
  width: 99%;
  height: 50%;
  display: flex;
  justify-content: center;
}
.pmgdxc {
  width: 99%;
  height: 100px;
  margin-top: 33px;
}
.pSty {
  font-size: 36px;
  font-family: KaiTi, KaiTi-Regular;
  font-weight: 400;
  text-align: left;
  color: #000000;
  line-height: 28px;
}
.spanSty {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  font-size: 16px;
  font-family: Alibaba PuHuiTi, Alibaba PuHuiTi-Regular;
  font-weight: 400;
  text-align: left;
  color: #000000;
  line-height: 40px;
  text-indent: 2em;
}
.model1 {
  width: 99.9%;
  /* height: 600px; */
  /* background: url("../assets/image/dpm1.png") no-repeat; */
  background-size: 100% 100%;
}
.sywz {
  font-size: 49px;
  font-family: PingFang SC, PingFang SC-Semibold;
  font-weight: 600;
  text-align: center;
  color: #ffffff;
  margin-top: 0;
}
.model2 {
  width: 99.9%;
  height: 600px;
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
  flex-direction: column;
  background: url('../assets/image/dbj2.png') no-repeat;
  background-size: 100% 100%;
}
.photo {
  width: 333px;
  height: 118px;
  text-align: center;
  background: url("../assets/image/gysq.png") no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  /* display: block; */
}
.bzjd {
  width: 70%;
  height: 60%;
  display: flex;
  justify-content: space-between;
}
.box1 {
  width: 30%;
  height: 100%;
  display: inline-block;
  border: 1px solid black;
}
.model3 {
  width: 99.9%;
  height: 600px;
  border: 1px solid black;
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
}
/deep/ .el-carousel__container {
    position: relative;
    height: 600px;
}
 .imdt{
  width: 100%;
  height: 100%;

 }
.medium2{
position: absolute;
    left: 5rem;
    bottom: 10rem;
    font-size: 50px;
    color: white;
    /* text-decoration-line: underline; */
    font-weight: 900;
    font-family:Georgia, 'Times New Roman', Times, serif;
    font-size: 48px;
    line-height: 100%;
    display: flex;
    align-items: center;
    flex: none;
    order: 1;
    align-self: stretch;
    animation: slide-up 8s;
}
.medium1{
    position: absolute;
    left: 5rem;
    bottom: 15rem;
    font-size: 50px;
    color: white;
    /* text-decoration-line: underline; */
    font-weight: 900;
    font-family:Georgia, 'Times New Roman', Times, serif;
    font-size: 48px;
    line-height: 100%;
    display: flex;
    align-items: center;
    flex: none;
    order: 1;
    align-self: stretch;
}
.carousel-container {
  width: 100%;
  height: 150px;
  /*padding: 10px;*/
  background: #fff;
  overflow: hidden;
}

.carousel-wrapper {
  display: flex;
  animation: slide 15s infinite;
}

.carousel-item {
  width: 295px;
  height: 150px;
  margin-left: 10px;
}

.carousel-image {
  width: 100%;
  height: 100%;
}
/* @keyframes slide {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
} */
/deep/ .VueCarousel-dot{
    display: inline-block;
    cursor: pointer;
    appearance: none;
    border: none;
    background-clip: content-box;
    box-sizing: content-box;
    padding: 0;
    border-radius: 100%;
    outline: none;
    display: none;
}
.fade-transition {
  overflow: hidden;
}
.carousel-container {
  position: relative;
  height: 600px;
  overflow: hidden;
}
.model1 {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  /*animation: slide-up 8s;*/
}

@keyframes slide-up {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-100%);
  }
}
</style>
